#!/bin/bash
name=$1
path=$2
port=$3

if [ ! -n "$name" ]; then
  name="own"
fi

if [ ! -n "$path" ]; then
  path="/root"
fi

if [ ! -n "$port" ]; then
  port="83"
fi
echo $name
rm -rf ./cloudreve-docker
git clone https://gitee.com/wuma/cloudreve-docker.git
docker build -t cloudreve ./cloudreve-docker
docker stop $name
docker rm $name
docker run -d \
	--name $name \
	-p "${port}:83" \
	-v "${path}/${name}/log:/core/log" \
	-v "${path}/${name}/uploads:/core/uploads" \
	-v "${path}/${name}/db:/core/db" \
	-v "${path}/${name}/etc:/core/etc" \
cloudreve